﻿<!DOCTYPE html>
<html lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title></title>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" type="text/css" href="../../css/cloud-admin.css">
<link rel="stylesheet" type="text/css" href="../../css/themes/default.css" id="skin-switcher">
<link rel="stylesheet" type="text/css" href="../../css/responsive.css">

<link href="../../font-awesome/css/font-awesome.min.css" rel="stylesheet">
<!-- file-input -->
<link rel="stylesheet" type="text/css" href="../../js/file-input/fileinput.css" />
<!-- SELECT2 -->
<link rel="stylesheet" type="text/css" href="../../js/select2/select2.min.css" />
<!-- UNIFORM -->
<link rel="stylesheet" type="text/css" href="../../js/uniform/css/uniform.default.min.css" />
<!-- datatable -->
<link rel="stylesheet" href="../../js/datatables/datatable.css">
<link rel="stylesheet" type="text/css" href="../../css/animatecss/animate.min.css" />
<!-- WIZARD -->
<link rel="stylesheet" type="text/css" href="../../js/bootstrap-wizard/wizard.css" />

<style type="text/css">
.in_A .swiper-container {
	width: 100%;
	height: auto;
}

.in_B {
	padding: 1.125rem;
	overflow: hidden;
}

.in_B li {
	width: 25%;
	display: block;
	float: left;
}

.in_C {
	height: auto;
	width: 100%;
	overflow: hidden;
}

.in_C dt { /*width:7.075rem;*/
	width: 37.733%;
	position: relative;
	float: left;
}

.in_C dt .seckill {
	position: absolute;
	top: 0.5rem;
	left: 0.5rem;
}

.in_C dt .seckill .time {
	font-size: 0.75rem;
	color: #333;
	padding-left: 0.2rem;
}

.in_C dt .seckill .seck {
	font-size: 0.55rem;
}

.in_C dt .seckill .seck span {
	color: #808080;
	padding-left: 0.2rem;
}

.in_C dt .seckill .seck .sec {
	width: 3.5rem;
	height: 0.875rem;
	background: #fff;
	border-radius: 0.75rem;
	border: #7a6a56 solid 2px;
	font-size: 0.65rem;
	text-align: center;
	line-height: 0.875rem;
	color: #7a6a56;
	margin-top: 0.1rem;
}

.in_C dd { /*width:11.675rem;*/
	width: 62.266%;
	float: left;
}

.in_C dd p {
	overflow: hidden;
}

.in_C dd p:first-child {
	width: 100%;
}

.in_C dd p span {
	float: left;
}

.in_C dd p:last-child span:first-child {
	width: 49.892%;
}

.in_C dd p:last-child span:last-child {
	width: 50.107%;
}

.in_D {
	padding-bottom: 1.5rem;
}

.in_D .in_D_tit {
	height: 2.25rem;
	line-height: 2.25rem;
	font-size: 0.75rem;
	text-align: center;
	display: block;
	color: #333;
}

.in_D .in_D_lst {
	width: 100%;
	border-top: #eee solid 0.05rem;
	overflow: hidden;
}

.in_D .in_D_lst li {
	border-bottom: #eee solid 0.05rem;
	width: 25%;
	float: left;
}

.in_D .in_D_lst li a {
	display: block;
	width: 100%;
	border-left: #eee solid 0.05rem;
}

.in_D .in_D_lst li:first-child a {
	border-left: #fff solid 0.05rem;
}

.in_D .in_D_lst li:nth-child(5) a {
	border-left: #fff solid 0.05rem;
}

.in_D .in_D_lis {
	width: 100%;
	border-top: #eee solid 0.05rem;
	overflow: hidden;
}

.in_D .in_D_lis li {
	border-bottom: #eee solid 0.05rem;
	width: 50%;
	float: left; /*height:7.25rem;*/
	display: block;
}

.in_D .in_D_lis li a {
	border-left: #eee solid 0.05rem;
	background: url(../images/350.jpg) #f9f9f9 center center no-repeat;
	width: 100%;
	height: 100%;
	display: block;
	background-size: 4rem;
	-moz-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-webkit-box-sizing: border-box;
	-o-box-sizing: border-box;
	-ms-box-sizing: border-box;
}

.group-goods {
	
}

.group-goods-banner {
	height: 8.75rem;
}

.group-goods-lst {
	overflow: hidden;
	padding: 10px;
}

.group-goods-lst li {
	width: 142px;
	padding: 10px 10px 10px 10px;
	float: left;
}
.category-goods-lst {
	overflow: hidden;
	padding: 10px;
}

.category-goods-lst li {
	width: 80px;
	padding: 10px 10px 10px 10px;
	float: left;
}
.group-goods-lst li h3 {
	font-size: 0.6rem;
	color: #808080;
	position: relative;
	padding-top: 0.5rem;
}

.group-goods-lst li h3 b {
	color: #333;
	font-size: 0.7rem;
	padding-left: 0.15rem;
}

.group-goods-lst li h3 span {
	width: 1.425rem;
	height: 0.575rem;
	display: block;
	position: absolute;
	right: 0;
	top: 0.7rem;
}

img {
	width: 100%
}
ol li{
width:171px;
height:171px;
}
</style>

</head>

<body>
	<header class="navbar clearfix" id="header"> </header>

	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<div id="sidebar" class="sidebar">
			<div class="sidebar-menu nav-collapse">

				<ul>


				</ul>

			</div>

		</div>
		<!-- /SIDEBAR -->
		<div id="main-content">
			<!-- SAMPLE BOX CONFIGURATION MODAL FORM-->
			<div class="modal fade" id="box-config" tabindex="-1" role="dialog"
				aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<form id="form_focus">
						<div class="modal-content">
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
								<h4 class="modal-title">维护图片</h4>
							</div>
							<div class="modal-body">
								
								<div class="row" style="height: 100px">
									<label class="control-label col-md-3" style="line-height: 34px;">
										<span class="required">*</span>
										图片：
									</label>
									<form>
										<div class="col-md-8">
											<div hidden-image></div>
											<div class="fileinput fileinput-new" data-provides="fileinput">
												<div class="image_preview_list" style="float: left;" id="imgs">
													<div class="fileinput-preview thumbnail image_preview_default" data-trigger="fileinput"
														style="width: 120px; height: 90px;"></div>
												</div>
												<div style="float: left; margin-left: 5px; padding-top: 23px;" class="addnewimg"
													id="f_span">
													<span class="btn btn-default btn-file" id="fir">
														<span class="fileinput-new" id="two">上传图片</span>
														<span class="fileinput-exists">Change</span>
														<input type="file" name="uploadFile" upload-file="imageUrlProduct">
													</span>
													<div class="progress progress-striped active" role="progressbar" aria-valuemin="0"
														aria-valuemax="100" style="margin-bottom: 0px; margin-top: 10px;">
														<div class="progress-bar progress-bar-success" style="width: 0%;"></div>
													</div>
												</div>

											</div>


										</div>
									</form>

								</div>
								<div class="row">
									<label class="control-label col-md-3" style="line-height: 34px;">
										<span class="required">*</span>
										链接：
									</label>
									<div class="col-md-6">
										<textarea class="form-control" row=3 cols=15 name="linkUrl" placeholder="请输入链接Url"
											style="resize: none" maxlength="200"></textarea>

									</div>
								</div>


							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
								<button type="button" class="btn btn-primary bt-save">保存</button>
							</div>
						</div>
					</form>

				</div>
			</div>
			<!-- /SAMPLE BOX CONFIGURATION MODAL FORM-->
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">

						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- STYLER -->

									<!-- /STYLER -->
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="index.html">首页</a>
										</li>
										<li>
											<a href="#">商品管理</a>
										</li>
										<li>维护商品</li>
									</ul>
									<!-- /BREADCRUMBS -->

								</div>
							</div>
						</div>
						
					
							
						<!-- 上新 -->
							
						    <div class="row" style="margin-left: 20px;">							
							<button type="button" class="btn btn-success bt_uploadK" style="height:34px">增加图片</button>
						    </div>
						    <div class="row dd" name="newProductList" 
								style="width: 1024px;max-width: 1024px; margin-left: 10px;">
								<ul class="dd-list sortArea" style="width: 100%;display:block" >
										<!--<li>
											<img height="200px" src="http://m.yiigoo.com/images/useless/shouye/in_E1.jpg">
										</li>
										<li>
											<img height="200px"
												src="http://m.yiigoo.com/images/useless/shouye/in_E2.jpg?v=1">
										</li>
										
										<li>
											<img height="200px"
												src="http://m.yiigoo.com/images/useless/shouye/in_E3.jpg?v=12">
										</li-->
								</ul>

							</div>
							<!-- ｅｎｄ　上新-->
							
							
							
	<div class="row">
	<button type="button" class="btn btn-success bt_review" style="margin-top:100px;height:34px">保存</button>
	</div>
					</div>

				</div>
			</div>
		</div>
		</div>
	</section>
	<div style="display:none" id="divLi">
	<li class="dd-item filter-content" style="float:left"><img class="dd-handle img-responsive"   src="http://houtai.yiigoo.com/img/default.png?v=122" width="100%"><div class="hover-content animated fadeOut" style="display: block;"><a class="btn btn-success hover-link"><i class="fa fa-edit fa-1x"></i></a><a class="btn btn-danger hover-link colorbox-button"><i class="fa fa-times fa-1x"></i></a></div></li>
	</div>

</body>
<script src="../../js/jquery/jquery-2.0.3.min.js"></script>
<!-- JQUERY UI-->
<script src="../../js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
<!-- BOOTSTRAP -->
<script src="../../bootstrap-dist/js/bootstrap.min.js"></script>
<!-- SLIMSCROLL -->
<script type="text/javascript" src="../../js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="../../js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
<!-- BLOCK UI -->
<script type="text/javascript" src="../../js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
<!--bootbox-->
<script type="text/javascript" src="../../js/bootbox/bootbox.min.js"></script>
<!-- AUTOSIZE -->
<script type="text/javascript" src="../../js/autosize/jquery.autosize.min.js"></script>
<!-- spinner -->
<script src="../../js/spinner/spin.js"></script>
<!-- bootstrap-fileupload -->
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload.min.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload-process.min.js"></script>
<script type="text/javascript" src="../../js/jquery-upload/js/jquery.fileupload-validate.min.js"></script>

<!-- INPUT MASK -->
<script type="text/javascript" src="../../js/bootstrap-inputmask/bootstrap-inputmask.min.js"></script>

<!-- SELECT2 -->
<script type="text/javascript" src="../../js/select2/select2.min.js"></script>
<!-- UNIFORM -->
<script type="text/javascript" src="../../js/uniform/jquery.uniform.min.js"></script>
<!-- WIZARD -->
<script src="../../js/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>
<!-- WIZARD -->
<script src="../../js/jquery-validate/jquery.validate.min.js"></script>
<script src="../../js/jquery-validate/additional-methods.min.js"></script>
<script src="../../js/bootstrap-wizard/form-wizard.js"></script>
<!-- NESTABLE LISTS -->
<script type="text/javascript" src="../../js/nestable/jquery.nestable.min.js"></script>
<!-- COOKIE -->
<script type="text/javascript" src="../../js/jQuery-Cookie/jquery.cookie.min.js"></script>
<!-- CUSTOM SCRIPT -->
<script src="../../js/script.js"></script>
<script src="../../js/common.js"></script>
<script src="../../js/Sortable.min.js"></script>
<script>
	var Home = function() {
		var id = $.getUrlParam('id')
		var flag = $.getUrlParam('flag')
		var target = null;
		var img = {};
		
		var upLoadImg = function() {

			$("[upload-file=imageUrlProduct]")
					.fileupload(
							{
								url : App.getContextPath()
										+ "admin/file/uploadFile.do",
								formData : {
									fileType : "Mall"
								},
								dataType : 'json',
								acceptFileTypes : /(\.|\/)(gif|jpe?g|png|JPG?g)$/i,
								iframe : true,
								start : function(e) {
									$('.progress').fadeIn(300);
									return true;
								},
								autoUpload : true,
								done : function(e, data) {
									var result = data.result;
									if(result.message!=""){
										$.alert(result.message);							
										return false;
									}else{
									var $tr = $(this).closest("form");
									$tr
											.find("[hidden-image]")
											.append(
													"<input type='hidden' name='imagePath' value='" + result.fileUrl+"' />");
									$tr.find(".image_preview_default").html(
											"<img src='"+result.fileUrl+"' />");
									img.imgPath = result.fileUrl;
									}

								},
								progressall : function(e, data) {
									var progress = parseInt(data.loaded
											/ data.total * 100, 10);
									$('.progress .progress-bar').css('width',
											progress + '%');
								}
							}).on('fileuploaddone', function(e, data) {
						$(".progress").fadeOut(300);

					});
		}

		var loadImg = function() {
			$.ajax({
						type : "GET",
						url : App.getContextPath()
								+ "admin/template/findMallTemplateById.do?id=" + id,
						async : true,
						success : function(result) {
							if (result != null) {
								result = result.extra
								var img = JSON.parse(result.imgPath);
								var s="";
								 //分类
								$.each(img,function(index,item){
								
								 s='<li class="dd-item filter-content" style="float:left"><img class="dd-handle img-responsive" src='+item.imgPath+'  json='+JSON.stringify(item)+' width="100%"><div class="hover-content animated fadeOut" style="display: block;"><a class="btn btn-success hover-link"><i class="fa fa-edit fa-1x"></i></a><a class="btn btn-danger hover-link colorbox-button"><i class="fa fa-times fa-1x"></i></a></div></li>'
							     
							      $("[name=newProductList]").find("ul").append(s);
	   							});  
	   							
								
								 setTimeout(function(){
								     handleHover();
									  $('.sortArea').nestable();
									//图片点击
										$("img").click(function() {
											upImg($(this));
										});
									  }, 2000);

						}
						}
					});

		}
		var saveImg = function(target) {
			img.linkUrl = $("[name=linkUrl]").val();
			
		if(img.linkUrl.indexOf("product.html")>0){
			img.imageType="Product";
			var i=img.linkUrl.indexOf("?");
			var k=img.linkUrl.substr(i+1,img.linkUrl.length).split("&");			
			img.searchKey=k[0].replace("productId=","");
		}
		if(img.linkUrl.indexOf("static")>0){
			img.imageType="WebView";					
			img.searchKey="";
		}
		if(img.linkUrl.indexOf("group")>0){
			img.imageType="Group";					
			img.searchKey="";
		}
		if(img.linkUrl.indexOf("seconds")>0){
			img.imageType="Seconds";					
			img.searchKey="";
		}
		if(img.linkUrl.indexOf("soapshare")>0){
			img.imageType="SoapShare";					
			img.searchKey="";
		}
		if(img.linkUrl.indexOf("category")>0){
			img.imageType="Category";					
			img.searchKey="";
		}
		if(img.linkUrl.indexOf("special?basicattribute=")>0){
		    var i=img.linkUrl.indexOf("=");
			var k=img.linkUrl.substr(i+1,img.linkUrl.length);			
			img.searchKey = k;
			img.imageType="FilterList";					
			
		}
		if(img.linkUrl.indexOf("list.html")>0){
			img.imageType="List";
			var i=img.linkUrl.indexOf("?");
			var k=img.linkUrl.substr(i+1,img.linkUrl.length);			
			img.searchKey = k;
			// var k=img.linkUrl.substr(i+1,img.linkUrl.length).split("&");			
			// img.searchKey=k[0].replace("tags=","").replace("key=","");
		}
		$(target).attr("src",img.imgPath);
		$(target).attr("json",JSON.stringify(img));
		$("#box-config").modal("hide");	
			
		
		}
		var upImg = function(that) {
			target = that;
			var json=target.attr("json");
			if(json){
			var obj=JSON.parse(target.attr("json"));
			img.linkUrl = obj.linkUrl;
			}
			
			img.imgPath = target.attr("src");
			var size = target.attr("size");
			img.name = target.attr("name");
		
			//img.id = target.attr("id");
			img.areaName = target.closest(".row").attr("name")

			$(".imgName").html(img.name);
			$(".imgSize").html(size);
			$("[name='imagePath']").val(img.imgPath);
			$(".image_preview_default").empty().append("<img src='"+img.imgPath+"'/>");

			$("[name=linkUrl]").val(img.linkUrl);
			$(".progress").hide();
			upLoadImg();
			$(".bt-save").unbind("click").click(function(){saveImg(target)});
			$("#box-config").modal("show");
		}
		//删除图片
		var delImg = function() {
			var name = $(this).closest("li").find("img").attr("name");
			var src = $(this).closest("li").find("img").attr("src");
			var that = $(this).closest("li");
		
				$.confirm("确认删除此图片?", function() {
					$(that).remove();
					
				});
			
		}
		var handleHover = function() {
			$('.filter-content').hover(
					function() {
						var hoverContent = $(this).children('.hover-content');
						hoverContent.removeClass('fadeOut').addClass(
								'animated fadeIn').show();
					}, function() {
						var hoverContent = $(this).children('.hover-content');
						hoverContent.removeClass('fadeIn').addClass('fadeOut');
					});
			$(".hover-content").find(".fa-edit").unbind("click").click(
					function() {
						var that = $(this).closest("li").find("img");
						upImg(that);
					});
			$(".hover-content").find(".btn-danger").unbind("click").click(
					delImg);
		}
		var tip = '<div class="hover-content"><a class="btn btn-success hover-link"><i class="fa fa-edit fa-1x"></i></a>'
				+ '<a class="btn btn-danger hover-link colorbox-button" ><i class="fa fa-times fa-1x"></i></a></div>';
		var review=function(){
			var home={};	
			home.id=id;
			home.imgType="NewProduct";
			home.imgPath=[];
					
			$("[name=newProductList]").find("img").each(function(index,item){
				home.imgPath.push(JSON.parse($(this).attr("json")));
				});
			home.imgPath=JSON.stringify(home.imgPath)
			
			//var s='{"group":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/4b22b9c5-2fd3-4a92-9c15-66be4b845d8b.jpg","name":"group","linkUrl":"http://m.yiigoo.com/product/product.html?productId=969","imageType":"Product","searchKey":"969","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/5110df50-1906-489d-a78f-b5f4c4a2d206.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=992","areaName":"groupList","imageType":"Product","searchKey":"992"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/2b6fdbef-f3b7-4049-b9e6-a3912e96a698.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=976","areaName":"groupList","imageType":"Product","searchKey":"976"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/acdd0dcb-73f1-4323-992c-ce468a115113.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=990","areaName":"groupList","imageType":"Product","searchKey":"990"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/0bd0c834-5f5d-47fe-8874-e1eef3a37110.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=979","areaName":"groupList","imageType":"Product","searchKey":"979"}]},"second":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/5fe27bc5-d43a-4528-b655-3d2e911ec16a.jpg","name":"second","linkUrl":"http://m.yiigoo.com/product/seconds.html?v=20180328","imageType":"Product","searchKey":"979","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/0acac4cb-1986-4986-8f80-9a8bc6eb4490.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","areaName":"secondList","imageType":"Product","searchKey":"1004"}]},"star":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/b1955d98-67a0-4c11-8751-98982589e93f.jpg","linkUrl":"http://m.yiigoo.com/static/1511439592.html","imageType":"WebView","searchKey":"","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/73114511-9fae-4193-8fae-dc6630e86c48.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","areaName":"starList","imageType":"Product","searchKey":"1004"}]},"selectList":[],"brandList":[],"hotSales":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/313cde18-3868-4f6b-8ee2-baa75769070d.jpg","name":"hotSales","linkUrl":"http://m.yiigoo.com/product/list.html?key=%E5%A4%8F%E8%A3%85&cname=%E5%A4%8F%E8%A3%85","imageType":"List","searchKey":"%E5%A4%8F%E8%A3%85","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/4ed2dff1-608f-4f33-9723-14d4fae39076.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=958","areaName":"hotSalesList","imageType":"Product","searchKey":"958"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/750343d0-2b89-43c9-a830-a9be62d70ef8.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=943","areaName":"hotSalesList","imageType":"Product","searchKey":"943"}]},"newProduct":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/284f9830-92e4-4d8b-9251-3b07ddbc26bc.jpg","name":"newProduct","linkUrl":"http://m.yiigoo.com/product/list.html?key=%E4%BA%B2%E5%AD%90&cname=%E4%BA%B2%E5%AD%90","imageType":"List","searchKey":"%E4%BA%B2%E5%AD%90","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ac29a4c7-a83b-48a6-972f-96101648ae7d.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/963fa169-a324-4f15-877a-8613cc130d67.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/16d54fb4-2604-4c45-b40b-d67bf9b7632c.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/d17aa16c-a429-4cd2-972d-e5d10dd9d8ac.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/af02ad7a-5dbc-4f63-b37e-aff6059d85e3.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ca324885-7b69-4ae2-894e-e45060c8a301.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"}]},"house":{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/fd4f7ea4-324d-4b27-b40a-2ac8de5f8f52.jpg","name":"house","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004","detailList":[{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/3d921521-9fd7-4ac2-9ee9-0baaab0854bd.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/c38f6cf0-df5f-4c57-a23e-7ccf414223f9.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/ca02cd75-02d4-4e36-85dc-27410502e414.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/6a3af7a7-7472-46e4-a33e-01262c7c9663.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/79aa67b5-6307-4cfc-9a7d-a279892d1182.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"},{"imgPath":"http://yiigoo-tmp.oss-cn-shanghai.aliyuncs.com/Mall/20180511/a08aaff1-259a-4433-97d2-f78aaa5ae68f.jpg","linkUrl":"http://m.yiigoo.com/product/product.html?productId=1004","imageType":"Product","searchKey":"1004"}]}}';'
			setTimeout(function(){
				$.confirm("确认数据都已经上传，保存后请在列表中设置生效日期!",function(){
				$.ajax({
					type : "post",
					url : App.getContextPath() + "admin/template/saveImg.do",
					async : true,
					data : $.param({
						img : JSON.stringify(home)
						
					}),
					success : function(result) {
						$.unblockUI();
						if (result.type == "success") {
							bootbox.dialog({
									message: '保存成功',
									title: "操作提示",
									buttons: {
											success: {
													label: "关闭",
													className: "btn-default",
													callback: function() {
															$(".bootbox").modal("hide");
															window.location.href = 'newproduct_list.html'
													}
											}
									}
							});
						}

					}
				}); 
				})
			},1000);
			
			
			
		}
		return {
			init : function() {
				//加载图片
				loadImg();

				//图片点击
				$("img").click(function() {
					upImg($(this));
				});
				$(".bt_review").click(review);
				$(".bt_uploadK").click(function() {
									
									var tag = $(this).closest("div");
									$($("#divLi").html()).prependTo($(tag).next().find("ul"))
									//$(tag).next().find("ul").append($("#divLi").html());
									//$("#divLi").html().appendTo($(tag).next().find("ol li:last-child"));
									//$(tag).next().find("ul li:last-child img").click(upImg);
									//$(tag).next().find("ul li:last-child button").click(delImg);
									
									handleHover();
									$('.sortArea').nestable();
									
								});
								//增加两个图片
				
				$(".savaSort").click(function(){
					var target=$(this).attr("data-areaname");
					var list=[];
					$("div[name="+target+"]").find("img").each(function(index,item){
						if(typeof $(this).attr("linkUrl")!="undefined"){
						var img = {};						
						img.areaName=target;
						img.name=target.replace("tag",'')+(index+1)
						img.imgPath=$(this).attr("src");
						img.linkUrl=$(this).attr("linkUrl");
						img.imgType="NewProduct";
						list.push(img);
						}
					});
					if(list.length==0){
						$.alert("请先上传图片");
						return false;
					}
					
				});
				
			}
		}
	}();
	$(function() {
		$("#header").load("../head.html");
		App.init();
		Home.init();
	});
</script>


</html>